package main

import (
	"fmt"
	"time"
)

// 管道同步，像之前的例子我们需要time.Sleep这种不优雅的方式来实现同步等待接收数据
func main() {
	bools := make(chan bool, 1)
	go work(bools)
	<-bools
}

func work(done chan bool) {
	fmt.Print("working...")
	time.Sleep(time.Second)
	fmt.Println("done")
	done <- true
}
